home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ahoy 1988 June
/
Ahoy_Magazine_88-06_1988_Double_L.d64
/
Easy as ...
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
531b
|
24 lines
0 print"[147]"tab(13)"easy as ..."
1 rem ==================================
2 rem commodares problem #49-4 :
3 rem easy as ...
4 rem solution by
5 rem e. hormats
6 rem ==================================
10 print"monte carlo method"
20 input"number of cycles wanted";cy
30 print"":p=0
40 for i=1 to cy
50 x=rnd(0): y=rnd(0)
60 z=x*x+y*y
70 if z>1 then 90
80 p=p+1
90 print"at ";i"[145]"
100 next i
110 pi=4*p/cy
120 print"value of [255] after"cy "trials is = ",pi
130 print"another try (y/n)"
140 get a$: if a$="y" then 20
150 if a$="n" then end
160 goto 140